/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef __LIB2D_GUI_VIEW_MARGINED_H__
#define __LIB2D_GUI_VIEW_MARGINED_H__

#include <lib2d/objects/Imagesimple.h>
#include <xml/Object.h>

namespace liba
{
namespace lib2d
{
namespace gui
{
namespace view
{

class Margined : public xml::ObjectANSI
{
public:
	struct Margins : public Rect
	{
		Margins()
		:	Rect( 0, 0, 0, 0 )
		{}
		double left()const		{ return x;	}
		double top()const		{ return y; }
		double right()const	{ return width; }
		double bottom()const	{ return height; }
	};
private:
	Rect rect;
	Margins margins;
public:
	Margined()
	:	rect( 0, 0, 0, 0 )
	{}
	void render( hard::Renderer * rend, objects::ImageSimple * img, double width, double height );
	const Rect & get_rect()const
	{
		return rect;
	}
	const Margins & get_margins()const
	{
		return margins;
	}
	virtual bool on_attribute( xml::Provider * prov, const std::string & name, const std::string & value );
};

} //namespace view
} //namespace gui
} //namespace lib2d
} //namespace liba

using namespace liba;

#endif //__LIB2D_GUI_VIEW_MARGINED_H__
